package com.dongdongshop.service.imp;

import com.alibaba.dubbo.config.annotation.Service;
import com.dongdongshop.mapper.TbAddressMapper;
import com.dongdongshop.pojo.AddressVo;
import com.dongdongshop.pojo.TbAddress;
import com.dongdongshop.service.AddressService;

import javax.annotation.Resource;
import java.util.List;

@Service
@org.springframework.stereotype.Service
public class AddressServiceImpl implements AddressService {
    @Resource
    private TbAddressMapper tbAddressMapper;

    @Override
    public List<AddressVo> getinfo() {
        List<AddressVo> list = tbAddressMapper.getinfo();
        return list;
    }

    @Override
    public Integer addinfo(TbAddress tbAddress) {
        return tbAddressMapper.insertSelective(tbAddress);
    }

    @Override
    public Integer deleteAddress(Long id) {
        return tbAddressMapper.deleteByPrimaryKey(id);
    }

    @Override
    public TbAddress getById(Long id) {
        return tbAddressMapper.selectByPrimaryKey(id);
    }

    @Override
    public Integer updateinfo(TbAddress tbAddress) {
        return tbAddressMapper.updateByPrimaryKeySelective(tbAddress);
    }

    @Override
    public AddressVo getByDefault() {
        return tbAddressMapper.getByDefault();
    }
}
